<!-- script for ckeditor <END_DECRIPT_TAG>
<script type="text/javascript" src="{$base_media}/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="{$base_media}/ckeditor/ckfinder/ckfinder.js"></script>
<START_DECRIPT_TAG> end script for ckeditor -->
<script type="text/javascript" charset="utf-8">
        // tabbed forms box
        $(function () {ldelim}
            var tabContainers = $('div#forms > div.innerContent'); // change div#forms to your new div id (example:div#pages) if you want to use tabs on another page or div.
            tabContainers.hide().filter(':first').show();

            $('ul.switcherTabs a').click(function () {ldelim}
                tabContainers.hide();
                tabContainers.filter(this.hash).show();
                $('ul.switcherTabs li').removeClass('selected');
                $(this).parent().addClass('selected');
                return false;
            {rdelim}).filter(':first').click();
        {rdelim});

        function checkForm()
        {ldelim}
            var banner = $('#adv_img').val();
            if (jQuery.trim(banner) == '') {ldelim}
                alert('Bạn chưa chọn ảnh để tải lên !');
                return false;
            {rdelim}

            var ext = banner.substring(banner.lastIndexOf('.'));
            if (!(ext && /^(.jpg|.JPG)$/i.test(ext))) {ldelim}
                alert('File ảnh được định dạng .jpg !');
                return false;
            {rdelim}
            if (findSize() == false ) {ldelim}
                return false;
            {rdelim}
            if (jQuery.trim($('#adv_url').val()) == '' || jQuery.trim($('#adv_url').val()) == 'http://') {ldelim}
                alert('Bạn chưa nhập URL cho ảnh quảng cáo');
                return false;
            {rdelim}
            return true;
        {rdelim}

        function executeCancel()
        {ldelim}
            window.history.back(-1);
        {rdelim}

        function findSize()
        {ldelim}
            if ( $.browser.msie ) {ldelim}
               var a = document.getElementById('adv_img').value;
                $('#myImage').attr('src',a);
                var imgbytes = document.getElementById('myImage').fileSize;
                var imgkbytes = Math.round(parseInt(imgbytes)/1024);
                if (imgkbytes > 78.3) {ldelim}
                    alert('Dung lượng file không được quá 78.3KB');
                    return false;
                {rdelim}
                //alert(imgkbytes+' KB');
            {rdelim} else {ldelim}
                var fileInput = $("#adv_img")[0];
                var imgbytes = fileInput.files[0].fileSize; // Size returned in bytes.
                var imgkbytes = Math.round(parseInt(imgbytes)/1024);
                if (imgkbytes > 78.3) {ldelim}
                    alert('Dung lượng file không được quá 78.3KB');
                    return false;
                {rdelim}
                //alert(imgkbytes+' KB');
            {rdelim}
            return true;
        {rdelim}
</script>

<div id="leftBox">
{if $msgBoxDisp != ''}
<div class="{$clsType}Box" style="display:{$msgBoxDisp}">
  <div class="{$clsType}BoxTop">&nbsp;</div>
      {foreach from=$messages item=arrMsg}
        {foreach from=$arrMsg item=msg}
        <div class="msgBoxContent {$clsIcon}">
          <p>{$msg}</p>
          </div>
      {/foreach}
    {/foreach}
</div>
{/if}
<form id="mainForm" name="mainForm" method="post" action="{$actionForm}" enctype="multipart/form-data">
<div class="contentBox" id="forms">
  <div class="contentBoxTop">
    <h3>##TEM_ADD_EDIT## Quảng cáo</h3>
    <ul class="switcherTabs">
    </ul>
  </div>


        {if $records->adv_url != ''}
            {assign var='urlVal' value=$records->adv_url|escape}
        {else}
            {assign var='urlVal' value='http://'}
        {/if}
      <div class="innerContent" id="box-1">

        <p>##ADVERTISEMENT_FILE_FIELD_TITLE_1## <em>(Kích thước file : 271 x 171 px. Định dạng file .jpg)</em><br><br>
        <label>
        <input type="file" name="adv_img" id="adv_img" value="">
        </label>
        </p>
        <p class="classname">Chú thích<br>
            <label class="mediumInput">
                <input type="text" name="adv_desc" id="adv_desc" size="51" value="{$records->adv_desc|escape}">
            </label>
        </p>
          <p>##ADVERTISEMENT_TEXT_FIELD_TITLE_2##<br>
        <label class="mediumInput">
        <input type="text" name="adv_url" id="adv_url" value="{$urlVal}" size="51">
        </label>
        </p>
          <p class="classname"><label for="adv_show">Show Quảng Cáo
            <input type="checkbox" name="adv_show" id="adv_show" value="Y" {if $records->adv_show == 'Y'}checked{/if}>&nbsp;
          </label>
          </p>
          <p>
            <input name="" type="image" src="{$base_media}/images/bt_submit.gif" onclick="return checkForm();" />
          </p>

      </div>

</div>
<input type="hidden" name="id" id="id" value="{$id}"/>
<img id="myImage" src="" style="display:none;">
</form>
</div>
<script type="text/javascript" charset="utf-8">

</script>
<div id="sidebar" class="rightBoxes">
  <div class="rightBoxesTop">
    <h3>##LIST_FUNC##</h3>
  </div>
  <div class="rightContent">
    <ul id="sidebarLinks">
      <li><a href="javascript:void(0);" onclick="javascript:executeCancel()">##SUBMIT_CANCEL##</a></li>
    </ul>
  </div>
</div>
<!-- end of #sidebar -->